#include <bits/stdc++.h>
using namespace std;
char ran[1000];
long long n,m,a[10000],c[10000],ans,f[100000];
int main()
{
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    cin >> n >> m;
    for (int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    for (int i = 2;i <= m;i++)
    {
        cin >> c[i];
        ans = max (ans,c[i]);
    }
    int x = 1
    while(cin >> ran[x])
    {
        x++;
    }

    for (int q = 1;q <= m;i++)
    {
        if (a[c[i]] > c[i]/2)
            cout << c[i];
    }
    return 0;
}
